import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('enemyCtl')
export class enemyCtl extends Component {
    @property(Node)
    hero: Node
    @property(Prefab)
    enemy: Prefab
    start() {
        this.creatEnemy()
    }

    creatEnemy() {
        // this.schedule(() => {
        //     let enemyPrefab = instantiate(this.enemy)
        //     // enemyPrefab.setParent(this.node)
        //     this.node.addChild(enemyPrefab)
        //     enemyPrefab.setPosition(this.hero.position.x + 300, this.hero.position.y)

        // }, 5, 4, 5)
        for (let i = 0; i < 6; i++) {
            let enemyPrefab = instantiate(this.enemy)
            this.node.addChild(enemyPrefab)
            // enemyPrefab.setPosition()
        }
    }

    update(deltaTime: number) {

    }
}


